<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./data.js"></script>
    <script>
        // console.log(data);
        // data 是json格式字符串
        var res = JSON.parse(data);
        // for(var v in res){
        //     console.log(v);
        // }
        // console.log(res['data']['forecast'].length);
        var arr = []
        for(var v of res['data']['forecast']){
            // 创建一个新对象 
            var new_obj = {};
            // 从v中提炼数据到新对象中  
            new_obj['ymd'] = v['ymd']
            new_obj['week'] = v['week']
            new_obj['high'] = v['high']
            new_obj['low'] = v['low']
            new_obj['fx'] = v['fx']
            new_obj['type'] = v['type']
            new_obj['notice'] = v['notice']

            // console.log(new_obj);

            arr.push(new_obj);

        }

        // console.log(arr);
        
    </script>
</body>
</html>